package cci.jdbc;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class connexionJavaDB {
	
	private static DataSource ds;
	
	public static DataSource getInstance(){
		
		if(ds == null){
			Context initCtx;
			try {
				initCtx = new InitialContext();
				ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/siteMarchand");
			} catch (NamingException e) {
				System.err.println("Erreur de connexion : " + e );
				e.printStackTrace();
			}
		}
		
		return ds;
		
	}
	

}
